﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XrmLibrary.MsCrm4Adapter.Extensions
{
    public static class PagingInfoExtensions
    {
        public static Microsoft.Crm.Sdk.Query.PagingInfo ToCrm4PagingInfo(this Microsoft.Xrm.Sdk.Query.PagingInfo crm2011PagingInfo)
        {
            Microsoft.Crm.Sdk.Query.PagingInfo crm4PagingInfo =
                new Microsoft.Crm.Sdk.Query.PagingInfo()
                {
                    Count = crm2011PagingInfo.Count,
                    PageNumber = crm2011PagingInfo.PageNumber,
                    PagingCookie = crm2011PagingInfo.PagingCookie
                };

            return crm4PagingInfo;
        }

        public static Microsoft.Xrm.Sdk.Query.PagingInfo ToCrm2011PagingInfo(this Microsoft.Crm.Sdk.Query.PagingInfo crm4PagingInfo)
        {
            Microsoft.Xrm.Sdk.Query.PagingInfo crm2011PagingInfo =
                new Microsoft.Xrm.Sdk.Query.PagingInfo()
                {
                    Count = crm4PagingInfo.Count,
                    PageNumber = crm4PagingInfo.PageNumber,
                    PagingCookie = crm4PagingInfo.PagingCookie,
                };

            return crm2011PagingInfo;
        }
    }
}
